class bidict:
    def __init__(self):
        self.dict = None
    
    def build(self, dict):
        lst = list(dict.values())
        set_lst = set(lst)
        if len(lst) != len(set_lst):
            print("failed to build bidict")
            return False
        else:
            self.dict = dict
            return True
    
    def get(self, key):
        if self.dict != None:
            return self.dict[key]
        else:
            return None
    
    def flip_get(self, value):
        for k,v in self.dict.items():
            if value == v:
                return k
        return None

t = bidict()
a_dict = {'a':100, 'b':200, 'c':300}
t.build(a_dict)
print(t.get('a'))
print(t.flip_get(200))
print(t.flip_get(500))
            